package com.hnkywl.sts.entity.zjgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sfgl.Sfk;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 说明：票据管理
 * 包:        com.hnkywl.sts.entity.zjgl
 * 类描述:    票据管理
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@Table(name = "T_BIZ_PJ")
@Where(clause = "deleted!='1'")
public class Pj extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqPjgl", allocationSize = 1, sequenceName = "SEQ_BIZ_PJGL")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqPjgl")
    private Long id;

    /**
     * 公司名称
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="NBGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg nbgs;
    /**
     * 票据收付类型    0 应收票据  1 应付票据
     */
    private Integer pjsflx;


    /**
     * 票据类型     0 银票  1 商票
     */
    private Integer pjlx;


    /**
     * 出票日期
     */
    private Date cprq;

    /**
     * 票据号码
     */
    private String pjhm;
    /**
     * 考核状态   0 为考核  1 已考核
     */
    private Integer khzt;
    /**
     * 考核开始
     */
    private Boolean khks;

    /**
     * 考核截止
     */
    private Boolean khjz;

    /**
     * 应付出票银行
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="YFCPYH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Khh yfcpyh;

    /**
     * 应收出票银行
     */
    private String yscpyh;

    /**
     * 使用日期
     */
    private Date syrq;

    /**
     * 到期日
     */
    private Date dqr;
    /**
     * 票据状态 1.无状态  2.已贴现 3.已托收  4承兑  5已使用 6已兑换
     */
    private Integer status;

    /**
     * 到期金额
     */
    private Double dqje;
    /**
     * 保证金
     */
    private String bzj;
    /**
     * 出票人
     */
    private String cpr;

    /**
     * 导入使用
     */
    @Transient
    private String czzt;

    /**
     * 收款人
     */
    private String skr;

    /**
     * 收票人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="SPR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg spr;
    /**
     * 交票单位
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="JPDW_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jpdw;

    /**
     * 交票日期
     */
    private Date jprq;

    /**
     * 应收利息
     */
    private Double yslx;

    /**
     * 应付利息
     */
    private Double yflx;

    /**
     * 备注
     */
    private String bz;
    //票据关联的付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk sk;


    //票据关联的付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SFK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk sfk;


    /**
     * 票据兑换
     */
    @OneToMany(mappedBy = "dhpj", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Pj.class)
    @Where(clause = "deleted=0")
    private List<Pj> pjdhList;

    /**
     * 票据兑换
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DHPJ_ID")
    private Pj dhpj;


    /**
     * 会计年
     */
    @Column(name = "jiuqi_acctyear")
    private Integer acctyear;
    /**
     * 生成久其凭证时提供的ID
     */
    @Column(name = "jiuqi_uuid")
    private String uuid;
    /**
     * 久其返回的凭证ID
     */
    @Column(name = "jiuqi_voucher_id")
    private String voucherId;
    /**
     * 久其返回的凭证号
     */
    @Column(name = "jiuqi_voucher_num")
    private Integer voucherNum;
    /**
     * “久其插入标示”代码   1=未导入,2=导入开始,3=导入成功
     */
    @Column(name = "jiuqi_insert_flag")
    private Integer insertFlag = 1;
    /**
     * "久其删除标示”代码   1=未删除,2=删除开始,3=删除成功
     */
    @Column(name = "jiuqi_delete_flag")
    private Integer deleteFlag = 1;

    //初始化字段  凡是从老系统导入的为初始化字段  置为 1  其他为非初始化
    private String csh ;


    /**
     * 贴现承兑导入
     */
    @ManyToOne
    @JoinColumn(name="PJDR_ID")
    @NotFound(action= NotFoundAction.IGNORE)
    private Pjdr pjdr;

    /**
     * 内部划转收付款
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Pj.class, mappedBy = "nbhzpj")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Pj> nbhzPjList;

    //内部划转收付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "NBHZPJ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Pj nbhzpj;




    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }



    public Integer getPjsflx() {
        return pjsflx;
    }

    public void setPjsflx(Integer pjsflx) {
        this.pjsflx = pjsflx;
    }

    public Integer getPjlx() {
        return pjlx;
    }

    public void setPjlx(Integer pjlx) {
        this.pjlx = pjlx;
    }

    public Gsjg getNbgs() {
        return nbgs;
    }

    public void setNbgs(Gsjg nbgs) {
        this.nbgs = nbgs;
    }

    public Date getCprq() {
        return cprq;
    }

    public void setCprq(Date cprq) {
        this.cprq = cprq;
    }

    public String getPjhm() {
        return pjhm;
    }

    public void setPjhm(String pjhm) {
        this.pjhm = pjhm;
    }

    public Integer getKhzt() {
        return khzt;
    }

    public void setKhzt(Integer khzt) {
        this.khzt = khzt;
    }

    public Boolean getKhks() {
        return khks;
    }

    public void setKhks(Boolean khks) {
        this.khks = khks;
    }

    public Boolean getKhjz() {
        return khjz;
    }

    public void setKhjz(Boolean khjz) {
        this.khjz = khjz;
    }



    public Date getDqr() {
        return dqr;
    }

    public void setDqr(Date dqr) {
        this.dqr = dqr;
    }

    public String getBzj() {
        return bzj;
    }

    public void setBzj(String bzj) {
        this.bzj = bzj;
    }

    public BigDecimal getDqje() {
        BigDecimal bigDecimal = new BigDecimal(dqje==null?0:dqje);
        return bigDecimal;
    }

    public void setDqje(Double dqje) {
        this.dqje = dqje;
    }


    public Khh getYfcpyh() {
        return yfcpyh;
    }

    public void setYfcpyh(Khh yfcpyh) {
        this.yfcpyh = yfcpyh;
    }

    public String getYscpyh() {
        return yscpyh;
    }

    public void setYscpyh(String yscpyh) {
        this.yscpyh = yscpyh;
    }

    public String getCpr() {
        return cpr;
    }

    public void setCpr(String cpr) {
        this.cpr = cpr;
    }

    public String getSkr() {
        return skr;
    }

    public void setSkr(String skr) {
        this.skr = skr;
    }

    public Gsjg getSpr() {
        return spr;
    }

    public void setSpr(Gsjg spr) {
        this.spr = spr;
    }

    public Date getJprq() {
        return jprq;
    }

    public void setJprq(Date jprq) {
        this.jprq = jprq;
    }

    public Gsjg getJpdw() {
        return jpdw;
    }

    public void setJpdw(Gsjg jpdw) {
        this.jpdw = jpdw;
    }

    public BigDecimal getYslx() {
        BigDecimal bigDecimal = new BigDecimal(yslx==null?0:yslx);
        return bigDecimal;
    }

    public void setYslx(Double yslx) {
        this.yslx = yslx;
    }

    public BigDecimal getYflx() {
        BigDecimal bigDecimal = new BigDecimal(yflx==null?0:yflx);
        return bigDecimal;
    }

    public void setYflx(Double yflx) {
        this.yflx = yflx;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Sfk getSfk() {
        return sfk;
    }

    public void setSfk(Sfk sfk) {
        this.sfk = sfk;
    }


    public Integer getAcctyear() {
        return acctyear;
    }

    public void setAcctyear(Integer acctyear) {
        this.acctyear = acctyear;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(String voucherId) {
        this.voucherId = voucherId;
    }

    public Integer getVoucherNum() {
        return voucherNum;
    }

    public void setVoucherNum(Integer voucherNum) {
        this.voucherNum = voucherNum;
    }

    public Integer getInsertFlag() {
        return insertFlag;
    }

    public void setInsertFlag(Integer insertFlag) {
        this.insertFlag = insertFlag;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public Date getSyrq() {
        return syrq;
    }

    public void setSyrq(Date syrq) {
        this.syrq = syrq;
    }

    public List<Pj> getPjdhList() {
        return pjdhList;
    }

    public void setPjdhList(List<Pj> pjdhList) {
        this.pjdhList = pjdhList;
    }

    public Pj getDhpj() {
        return dhpj;
    }

    public void setDhpj(Pj dhpj) {
        this.dhpj = dhpj;
    }

    public String getCzzt() {
        return czzt;
    }

    public void setCzzt(String czzt) {
        this.czzt = czzt;
    }

    public String getCsh() {
        return csh;
    }

    public void setCsh(String csh) {
        this.csh = csh;
    }

    public Sfk getSk() {
        return sk;
    }

    public void setSk(Sfk sk) {
        this.sk = sk;
    }

    public Pjdr getPjdr() {
        return pjdr;
    }

    public void setPjdr(Pjdr pjdr) {
        this.pjdr = pjdr;
    }

    public List<Pj> getNbhzPjList() {
        return nbhzPjList;
    }

    public void setNbhzPjList(List<Pj> nbhzPjList) {
        this.nbhzPjList = nbhzPjList;
    }

    public Pj getNbhzpj() {
        return nbhzpj;
    }

    public void setNbhzpj(Pj nbhzpj) {
        this.nbhzpj = nbhzpj;
    }
}
